<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="text/javascript">
        var regex = new RegExp('xyz', 'i');
        console.log(regex);
        // 等价于
        var regex2 = /xyz/i;
        console.log(regex2);
    </script>
</body>

</html>